// 初始化admin和root用户
db = db.getSiblingDB('admin');

db.createUser({
  user: "admin",
  pwd: "pass@2022",
  roles: [
    { role: "readWriteAnyDatabase", db: "admin" },
    { role: "dbAdminAnyDatabase", db: "admin" }
  ]
});

db.createUser({
  user: "root",
  pwd: "root@2022",
  roles: [ { role: "root", db: "admin" } ]
});